/*
* Copyright (c) 2011 Connection Road.  All rights reserved.
* This program and the accompanying material are made available
* under the terms of the Eclipse Public Licnese v1.0 which is
* available at http://www.eclipse.org/legal/epl-v10.html
*/

using System;
using Microsoft.Synchronization.Files;

namespace CrSyncFilesUtils {
    public class FileSyncApplyingChangesEventArgs: EventArgs{

        public FileSyncApplyingChangesEventArgs(ApplyingChangeEventArgs args,string sourcePath = "",string destinationPath="")
        {
            SourceArguments = args;
            SourcePath = sourcePath;
            DestinationPath = destinationPath;
            PreviewMode = false;
        }

        public FileSyncApplyingChangesEventArgs(ApplyingChangeEventArgs args, string sourcePath = "", string destinationPath = "",bool mode = false) {
            SourceArguments = args;
            SourcePath = sourcePath;
            DestinationPath = destinationPath;
            PreviewMode = mode;
        }

        public bool PreviewMode { get; private set; }
        public ApplyingChangeEventArgs SourceArguments { get; private set; }
        public string SourcePath { get; private set; }
        public string DestinationPath { get; private set; }
        public ChangeType ChangeType
        {
            get { return SourceArguments.ChangeType; }
        }
        public string ChangeTypeDisplayString
        {
            get
            {
                var currentChangeType = SourceArguments.ChangeType;
                switch (currentChangeType)
                {
                    case ChangeType.Create:
                        return "New";
                    default:
                        return currentChangeType.ToString();
                }
            }
        }
        public FileData CurrentFileData { get { return SourceArguments.CurrentFileData; } }
        public FileData NewFileData { get { return SourceArguments.NewFileData; } }
        public bool SkipChange { get { return SourceArguments.SkipChange; } }
        public long TotalBytesToCopy { get { return SourceArguments.NewFileData.Size; } }
        public string LastModified
        { 
            get { return string.Format("{0:MM/dd/yyyy}", SourceArguments.NewFileData.LastWriteTime); } 
        }
    }

}
